// 倒计时
export function countDown(date) {
  var nowtime = new Date(), //获取当前时间
    endtime = new Date(date); //定义结束时间
  var lefttime = endtime.getTime() - nowtime.getTime(), //距离结束时间的毫秒数
    day = Math.floor(lefttime / (1000 * 60 * 60 * 24)), //计算天数
    hour = Math.floor((lefttime / (1000 * 60 * 60)) % 24), //计算小时数
    minute = Math.floor((lefttime / (1000 * 60)) % 60), //计算分钟数
    second = Math.floor((lefttime / 1000) % 60); //计算秒数

  if (day <= 9) day = '0' + day;
  if (hour <= 9) hour = '0' + hour;
  if (minute <= 9) minute = '0' + minute;
  if (second <= 9) second = '0' + second;

  return {
    day,
    hour,
    minute,
    second
  };
}